package com.athuiju.fenxiaoback.service.impl;

import com.athuiju.fenxiaoback.entity.Goods;
import com.athuiju.fenxiaoback.entity.TbSku;
import com.athuiju.fenxiaoback.entity.TbSpu;
import com.athuiju.fenxiaoback.entity.TbSpuDetail;
import com.athuiju.fenxiaoback.entity.vo.TbGoodsQuery;
import com.athuiju.fenxiaoback.entity.vo.TbSpuQuery;
import com.athuiju.fenxiaoback.entity.vo.TbSpuQueryByCid2;
import com.athuiju.fenxiaoback.mapper.GoodsMapper;
import com.athuiju.fenxiaoback.mapper.TbSpuMapper;
import com.athuiju.fenxiaoback.service.GoodsService;
import com.athuiju.fenxiaoback.utils.PageUtils;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements GoodsService {


    @Autowired
    TbSpuMapper tbSpuMapper;


    @Override
    public void pageQueryByCid3(Page<TbSpu> page, TbSpuQueryByCid2 goodsQuery) {
        QueryWrapper<TbSpu> spuWrapper=new QueryWrapper<>();
        spuWrapper.like("cid3",goodsQuery.getCid3());
        spuWrapper.select("id","spu_image","title","sub_Title","cid1","cid2","cid3","brand_id","saleable","special_spec","generic_spec","description","sellpoint","soldout","valid");
        IPage<TbSpu> spuList = tbSpuMapper.selectPage(page, spuWrapper);
    }

    @Override
    public PageUtils queryPageByCondition(Map<String, Object> params) {
        return null;
    }

    @Override
    public void pageQuery(Page<TbSpu> page, TbSpuQuery goodsQuery) {
        QueryWrapper<TbSpu> spuWrapper=new QueryWrapper<>();
        spuWrapper.like("title",goodsQuery.getGoodsName());
        spuWrapper.select("id","spu_image","title","sub_Title","cid1","cid2","cid3","brand_id","saleable","special_spec","generic_spec","description","sellpoint","soldout","valid");
        IPage<TbSpu> spuList = tbSpuMapper.selectPage(page, spuWrapper);
    }


}
